//
//  MyAssistantViewController.m
//  CPetro
//
//  Created by ggx on 2017/3/8.
//  Copyright © 2017年 高广校. All rights reserved.
//

#import "MyAssistantViewController.h"
#import "AssistantInfoViewController.h"

#import "MyAssistantCell.h"
@interface MyAssistantViewController ()

@end

@implementation MyAssistantViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"我的店员";
//    self.baseData = @[@"",@""];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"UserAssistantTianjia"] style:UIBarButtonItemStyleDone target:self action:@selector(addAssistantViewController)];
}
#pragma mark -增加店员
-(void)addAssistantViewController{
    PushViewControllerName(@"AddAssistantViewController");
}
-(void)refreshView{
    EntityAssistant *t = (EntityAssistant *)[EntityAssistant getObjectFromDic:@{}];
    t.assistantName   = @"长大盒子";
    t.assistantStatus = @"1";
    t.assistantAccount = @"111";
    
    EntityAssistant *t1 = (EntityAssistant *)[EntityAssistant getObjectFromDic:@{}];
    t1.assistantName   = @"微笑";
    t1.assistantStatus = @"2";
    t1.assistantAccount = @"111";
    
    EntityAssistant *t2 = (EntityAssistant *)[EntityAssistant getObjectFromDic:@{}];
    t2.assistantName   = @"玉皇大帝";
    t2.assistantStatus = @"1";
    t2.assistantAccount = @"111";
    
    
    [self.baseData addObject:t];
    [self.baseData addObject:t2];
    [self.baseData addObject:t1];
}
-(void)loadMore{
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [self.baseData count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellidenti = @"MyAssistantCell";
    MyAssistantCell *cell = [tableView dequeueReusableCellWithIdentifier:cellidenti];
    if (!cell) {
        cell = [[MyAssistantCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellidenti];
    }
    cell.assistantData = self.baseData[indexPath.row];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    AssistantInfoViewController *Vc = CreateViewController(@"AssistantInfoViewController");
    Vc.entityAssistant = [(MyAssistantCell *)[tableView cellForRowAtIndexPath:indexPath] assistantData];
    PushViewController(Vc);
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
